package com.aplink.generic.webservice;

public enum HttpResponseStatus {
	BAD_GATEWAY(502),
	BAD_REQUEST(400),
	CONNECTION_TIMED_OUT(522),
	FORBIDDEN(403),
	GATEWAY_TIMEOUT(504),
	INTERNAL_SERVER_ERROR(500),
	JSON_PARSER_ERROR(1000),
	NOT_FOUND(404),
	NOT_IMPLEMENTED(501),
	SERVICE_UNAVAILABLE(503),
	SUCCESS(200),
	UNAUTHORIZED(401),
	UNKNOW_ERROR(0);
	public static HttpResponseStatus get(final int code) {
		for (final HttpResponseStatus status : HttpResponseStatus.values()) {
			if (status.mCode == code) {
				return status;
			}
		}
		return UNKNOW_ERROR;
	}

	private int mCode;

	private HttpResponseStatus(final int code) {
		this.mCode = code;
	}
}
